package headfirst.combined.djview;

import static org.junit.Assert.*;

import org.junit.Test;
	
public class RPMControllerTest {
	RPMModel rpmModel;
	RPMController rpmController;
	int rpm1, rpm2;
	
	@Test
	public void testStart() {
		rpmModel = new RPMModel();
		rpmController = new RPMController(rpmModel);
		rpmController.start();
		assertEquals("",1000,rpmModel.getRPM());
	}

	@Test
	public void testStop() {
		rpmModel = new RPMModel();
		rpmController = new RPMController(rpmModel);
		rpmController.stop();
		assertEquals("",0,rpmModel.getRPM());
	}

	@Test
	public void testIncreaseRPM() {
		rpmModel = new RPMModel();
		rpmController = new RPMController(rpmModel);
		rpm1 = rpmModel.getRPM();
		rpmController.increaseRPM();
		rpm2 = rpmModel.getRPM();
		assertTrue("",rpm1<rpm2);
	}

	@Test
	public void testDecreaseRPM() {
		rpmModel = new RPMModel();
		rpmController = new RPMController(rpmModel);
		rpm1 = rpmModel.getRPM();
		rpmController.decreaseRPM();
		rpm2 = rpmModel.getRPM();
		assertTrue("",rpm1>rpm2);
	}
}
